The present disclosure relates to the field of blocking application program interfaces (APIs), and more specifically, to predicting exhausted storage for a blocking API.
A blocking API is an API that provides multiple records back to a requestor in a blocked format. Blocking APIs are configured to collect records in a buffer and to provide the records to a requestor once the buffer is filled. For example, records could be generated once per second and the API can utilize a buffer that would support holding ten records. Blocking APIs provide performance benefits by reducing the per record overhead associated with providing the records to the requestor.
In the event that the records are produced at a sporadic rate and there is a timely-ness requirement for the data to be made available to the requestor, traditional blocking APIs can cause additional latency. For example, a problem arises when the buffer is close to full and another record is not immediately available. In this case, traditional blocking APIs will wait until the next record is made available before providing the records to the requestor. Only once the next record has been received by the blocking API, can it be determined if the record will fit into the buffer. If the record will not fit into the buffer then data in the buffer is provided to the requestor, without this newly available record. This additional latency is then added to those records being available to the requestor.